# 多维数组的运算
import numpy as np

if __name__ == "__main__":
    B = np.array([[1, 2], [3, 4], [5, 6]])
    print(B)
    ndim = np.ndim(B)
    shape = np.shape(B)
    print(f'数组B的维数为:{ndim}, 形状为{shape}')

    # 矩阵乘法
    A = np.array([[1, 2], [3, 4]])
    C = np.array([[5, 6], [7, 8]])
    D = np.array([[12, 15, 13], [19, 11, 0]])
    E = np.array([[1, 2], [55, 7], [62, 12]])
    res = np.dot(A, C)
    print(f'数组A和C的乘积:\n{res}')
    print(f'数组D和E的乘积:\n{np.dot(D, E)}')